<!DOCTYPE HTML>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0, minimum-scale=1.0, user-scalable=0, initial-scale=1.0, width=device-width" />
    <meta name="format-detection" content="telephone=no, email=no, date=no, address=no">
    <title>通讯录</title>
    <link rel="stylesheet" type="text/css" href="../css/api.css" />
    <link rel="stylesheet" type="text/css" href="../css/public.css" />
    <style>
        html,
        body {
            background-color: #ededed;
        }
        .list-item{line-height: 3rem;border-bottom: 1px solid #ccc;}
    </style>
</head>

<body>
    <div id="app">
        <div class="list-item" v-for="v in contactseList" @click="fnOpen(v,'chat');">{{v}}</div>
    </div>
</body>
<script type="text/javascript" src="../script/api.js"></script>
<script type="text/javascript" src="../script/vue.min.js"></script>
<!-- 消除移动端点击延迟300ms -->
<script type="text/javascript" src="../script/fastclick.js"></script>
<!-- 公共js -->
<script type="text/javascript" src="../script/common.js"></script>
<!-- 环信接口 -->
<script type="text/javascript" src="../script/easeChat.js"></script>
<!-- sha1加密 -->
<script type="text/javascript" src="../script/SHA1.js"></script>
<script type="text/javascript">
    apiready = function() {
        fngetContacts((ret)=>{
          vm.contactseList = ret.list
        });
    };

    var vm = new Vue({
        el: "#app",
        data: {
            contactseList: []
        },
        methods: {
            fnOpen: function(conversationid, chat) {
                // 新建一个会话
                fnGetConversation(conversationid, chat)
                api.openWin({
                    name: 'chat',
                    url: './chat/chat_win.html',
                    slidBackEnabled: true,
                    pageParam: {
                        conversationid: conversationid,
                        type: chat
                    }
                })
            }
        }
    });
</script>

</html>
